window: don't schedule a display of mnemonics if window has no modifier
authorCosimo Cecchi <cosimoc@gnome.org>
Tue, 2 Apr 2013 20:36:30 +0000 (16:36 -0400)
committerCosimo Cecchi <cosimoc@gnome.org>
Tue, 2 Apr 2013 21:39:44 +0000 (17:39 -0400)
When the window has no mnemonics modifier set, as in the case of a
GtkMenu, never schedule a display of mnemonics on focus-in.

Previously, for those windows, the GdkModifierType mask fetched from the
device would typically have been zero, leading to the

mnemonic_modifier == (mask & gtk_accelerator_get_default_mod_mask ())

check to succeed, so we would always trigger a display for popup menus.

https://bugzilla.gnome.org/show_bug.cgi?id=697144

gtk/gtkwindow.c

index cddf22772cf07bfea1b39444e0bfc190a9c079eb..eaf0b5729c90545ad0943a3dfbfabd2d0a421788 100644 (file)
@@ -7138,6 +7138,9 @@ gtk_window_has_mnemonic_modifier_pressed (GtkWindow *window)
   GdkDeviceManager *device_manager;
   gboolean retval = FALSE;
 
+  if (!window->priv->mnemonic_modifier)
+    return FALSE;
+
   device_manager = gdk_display_get_device_manager (gtk_widget_get_display (GTK_WIDGET (window)));
   devices = gdk_device_manager_list_devices (device_manager, GDK_DEVICE_TYPE_MASTER);